/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ships.core.models;

import ships.core.AbstractDataBuffer;
import ships.core.models.MemoryModel;

/**
 *
 * @author fqhuy
 */
public abstract class SampleModel {

    /** Number of bands of the image data that this SampleModel describes. */
    protected int width;
    protected int height;
    protected int numBands;

    public SampleModel(int w, int h, int bands) {
    }

    public SampleModel() {
    }
    /**
     * @return the width
     */
    public int getWidth() {
        return width;
    }

    /**
     * @param width the width to set
     */
    public void setWidth(int width) {
        this.width = width;
    }

    /**
     * @return the height
     */
    public int getHeight() {
        return height;
    }

    /**
     * @param height the height to set
     */
    public void setHeight(int height) {
        this.height = height;
    }

    /**
     * @return the numBands
     */
    public int getNumBands() {
        return numBands;
    }

    /**
     * @param numBands the numBands to set
     */
    public void setNumBands(int numBands) {
        this.numBands = numBands;
    }

    public abstract <T extends Number> T getSample(int x, int y, int b, AbstractDataBuffer data);

    
    public abstract SampleModel createCompatibleSampleModel(int w, int h);

    /**
     * Creates a new SampleModel
     * with a subset of the bands of this
     * SampleModel.
     * @param bands the subset of bands of this <code>SampleModel</code>
     * @return a <code>SampleModel</code> with a subset of bands of this
     *         <code>SampleModel</code>.
     */
    public abstract SampleModel createSubsetSampleModel(int bands[]);

    /**
     * Creates a DataBuffer that corresponds to this SampleModel.
     * The DataBuffer's width and height will match this SampleModel's.
     * @return a <code>DataBuffer</code> corresponding to this
     *         <code>SampleModel</code>.
     */
    public abstract  <T extends Number> AbstractDataBuffer createDataBuffer(MemoryModel memoryModel, T initVal);

    /** Returns the size in bits of samples for all bands.
     *  @return the size of samples for all bands.
     */
    public abstract int[] getSampleSize();

    /** Returns the size in bits of samples for the specified band.
     *  @param band the specified band
     *  @return the size of the samples of the specified band.
     */
    public abstract int getSampleSize(int band);

}
